package com.ruoyi.bizsys.controller;

import com.ruoyi.bizsys.query.UserActivityGroupQuery;
import com.ruoyi.bizsys.service.IUserActivityGroupService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * 【请填写功能名称】Controller
 *
 * @author african-loan
 * @date 2022-06-23
 */
@RestController
@RequestMapping("/userActivityGroup")
public class UserActivityGroupController extends BaseController {
    @Autowired
    private IUserActivityGroupService userActivityGroupService;

    /**
     * 用户分组列表查询
     */
    @PreAuthorize("@ss.hasPermi('bizsys:group:list')")
    @GetMapping("/list")
    public TableDataInfo list(UserActivityGroupQuery userActivityGroupQuery) {
        startPage();
        assert StringUtils.isNotEmpty(userActivityGroupQuery.getAwardGroupCode()):"awardGroupCode is null";
        return getDataTable(userActivityGroupService.selectUserActivityGroupList(userActivityGroupQuery));
    }

    /**
     * 移除用户分组列表查询
     */
    @PreAuthorize("@ss.hasPermi('bizsys:group:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(userActivityGroupService.deleteUserActivityGroupByIds(ids));
    }
}
